package com.dosen.api.third.party.register.result.argocd.result;

/**
 * @version V1.0
 * @author: guangcheng
 * @date: 2022/5/6 20:09
 * @description:
 */
public class BusinessException extends BaseException {
    private static final long serialVersionUID = -1188113360929510411L;
    private int code;

    public BusinessException() {
    }

    public BusinessException(Throwable cause) {
        super(cause);
        this.code = 500;
    }

    public BusinessException(String message) {
        super(message);
        this.code = 500;
    }

    public BusinessException(String msgFormat, Object... args) {
        super(String.format(msgFormat, args));
        this.code = 500;
    }

    public BusinessException(String message, Throwable cause) {
        super(message, cause);
        this.code = 500;
    }

    public BusinessException(int code, String message) {
        super(message);
        this.code = code;
    }

    public BusinessException(int code, String msgFormat, Object... args) {
        super(String.format(msgFormat, args));
        this.code = code;
    }

    public BusinessException(BaseErrorCode errorCode) {
        super(errorCode.getMessage());
        this.code = errorCode.getCode();
    }

    public BusinessException(BaseErrorCode errorCode, Object... args) {
        super(String.format(errorCode.getMessage(), args));
        this.code = errorCode.getCode();
    }

    public int getCode() {
        return this.code;
    }
}

